<template>
    <h1>辅助函数的访问方式</h1>
    <h2>{{ cnum }}</h2>
    <button @click="add(2)">同步增加</button>
    <button @click="addAsync(3)">异步增加</button>
</template>

<script lang='ts'>
import {createNamespacedHelpers, mapState} from 'vuex'
const {mapState:mapCounterState,mapMutations:mapCounterMutatations,mapActions:mapCounterActions}=createNamespacedHelpers('counter')
export default{
    computed:{
        ...mapCounterState({"cnum":'num'})
    },
    methods:{
        ...mapCounterMutatations({"add":"increment"}),
        ...mapCounterActions({"addAsync":"incrementAsync"})
    }
}
</script>

<style lang='scss' scoped>
</style>